﻿var text2display = "";
var answers = new Array(5);
answers[0] = "1. Makes you tell the truth\n";
answers[1] = "2. Kryptonite\n";
answers[2] = "3. Bruce Wayne\n";
answers[3] = "4. Faster than light\n";
answers[4] = "5. Willpower\n";

var questions = new Array(5);
questions[0] = "q1";
questions[1] = "q2";
questions[2] = "q3";
questions[3] = "q4";
questions[4] = "q5";




function checkQs(s) {
    var qs = document.getElementsByName(s);
    var noOfRadios = qs.length;

    for (var i = 0; i < noOfRadios; i++) {
        if (qs[i].checked) {
            if (qs[i].value == "correct") {
                text2display += "You got that correct!\n";
            } else {
                text2display += answers[questions.indexOf(s)];
              
            }
               
        };
    };
};
function checkall() {
    for (var i in questions) {
        checkQs(questions[i]);
    };
    document.getElementById("answersBox").innerHTML = text2display;
};

